<!DOCTYPE html>
<html>
	<head>
		<title>MES Process Web</title>
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">-->
		<link rel="stylesheet" href="/css/bootstrap.min.css">
		<script src="/js/jquery.min.js"></script>
		<script src="/js/bootstrap.min.js"></script>
	</head>
	<body>
		<?php
			include "top.php";

			echo "<div class='container-fluid'>";
			echo "<div style='float:left'>";
			echo "	<form action='mesprocess.php?act=q' method='POST' role='form' class='form-inline'>";
			echo "		<div class='form-group'>";
			echo "			<label>机器序号</label>";
			if(strlen($sn)<=0){
				echo "			<input type='text' class='form-control' name='sn' placeholder='请输入机器序号'>";
			}else{
				echo "			<input type='text' class='form-control' name='sn' value='$sn'>";
			}
			echo "			</br><label>站别</label>";
			echo "			<input type='text' class='form-control' name='siteid' value='10001367'>";
			echo "			</br><label>LAN MAC</label>";
			echo "			<input type='text' class='form-control' name='lanmac' value='NA'>";

			echo "			</br><label>WIFI MAC</label>";
			echo "			<input type='text' class='form-control' name='wifimac' value='NA'>";

			echo "			</br><label>KEY ID</label>";
			echo "			<input type='text' class='form-control' name='keyid' value='NA'>";

			echo "			</br><label>OA3 KEY</label>";
			echo "			<input type='text' class='form-control' name='key' value='NA'>";
			echo "			</br><button type='submit' class='btn btn-info form-control'>过站</button>";
			echo "		</div>";
			echo "	</form>";
			echo "<br>";
			echo "<div>";

			extract($_POST);
			extract($_GET);
			unset($_POST,$_GET);
			
			if(isset($act) && strlen($sn)<=0)
				echo "<div>You need to input serial number</div>";
			else if (isset($act) && strlen($sn)>=10){
			
				$soapcli = new SoapClient("http://10.100.160.37/Service.asmx?wsdl");
				//$result = $soapcli->Check_Unique(array('TSN'=>$sn, 'TERIMINALID'=>'10001367', 'TLANMAC'=>'NA', 'TWIFIMAC'=>'NA', 'TBTMAC'=>'NA', 
				//								'TOAKEY'=>'NA', 'TIMEI'=>'NA', 'TWVBOX'=>'NA', 'THDD'=>'NA'));
				$result = $soapcli->SN_AutoProcess(array('TSN'=>$sn, 'TSITEY'=>"$siteid", 'TWO'=>'', 
														'TBIOS'=>'NA', 
														'TUUID'=>'NA', 
														'TLANMAC'=>"$lanmac", 
														'TWIFIMAC'=>"$wifimac", 
														'TBTMAC'=>'', 'TCPUID'=>''
													, 'TOAKEY'=>"$key", 'TIMEI'=>'', 'TSYSFLAG'=>'', 'TDINDEX'=>'BYMAN', 'TWVBOX'=>"$keyid", 'TSHIPIMAGE'=>'', 'TEMP'=>'TETESTREPROT'));
				$arrRes = json_decode(json_encode($result),TRUE);
				//print_r($result);
				//print_r($arrRes);
				print($arrRes['SN_AutoProcessResult']);
			}

		echo "</div>";
			include 'bottom.php';
		?>
	</body>
</html>